package DAO;

import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class ExamenTrat {
  public ExamenTrat() {
  }

  public Object[] ConsultaAppporClinic1(int petNum, int OwnerNum) {
    Conexion conexion = new Conexion();
    Connection conex;
    Object[] datos = new Object[100][100];
    try {
      conex = conexion.getConnection();
      PreparedStatement ps = null;
      ResultSet rs = null;

      ps =
          conex.prepareStatement("");
      int petNum1 = Integer.valueOf(petNum);
      int OwnerNum1 = Integer.valueOf(OwnerNum);
      ps.setInt(1, petNum1);
      ps.setInt(2, OwnerNum1);

      rs = ps.executeQuery();
      int i = 0;
      int j = 0;

      while (rs.next()) {

        datos[i] = rs.getInt(1);
        System.out.print(datos[i] + " ");
        j++;
        datos[i] = rs.getString(2);
        System.out.print(datos[i] + " ");
        j++;
        datos[i] = rs.getString(3);
        System.out.print(datos[i] + " ");
        j++;
        datos[i] = rs.getInt(4);
        System.out.print(datos[i] + " ");
        j++;

        datos[i] = rs.getInt(5);
        System.out.print(datos[i] + " ");
        j++;
        datos[i] = rs.getInt(6);
        System.out.print(datos[i] + " ");
        j++;
        datos[i] = rs.getInt(7);
        System.out.print(datos[i] + " ");
        j++;
        datos[i] = rs.getInt(8);
        System.out.print(datos[i] + " ");
        j++;
        datos[i] = rs.getInt(9);
        System.out.print(datos[i] + " ");
        i++;
        j = 0;
      }
    } catch (SQLException e) {
    }
    return datos;
  }

  public Object[] consultarTrata() {
    Conexion conexion = new Conexion();
    Connection conex;
    Object[] datos = new Object[100];
    try {
      conex = conexion.getConnection();
      PreparedStatement ps = null;
      ResultSet rs = null;

      ps = conex.prepareStatement("select treatmentNUMBER from TREATMENT ");

      rs = ps.executeQuery();
      int i = 0;
      while (rs.next()) {
        datos[i] = rs.getString(1);
        i++;
      }


    } catch (Exception e) {
    }
    return datos;
  }

  public Object[] consultarExa() {

    Conexion conexion = new Conexion();
    Connection conex;
    Object[] datos = new Object[100];
    try {

      conex = conexion.getConnection();
      PreparedStatement ps = null;
      ResultSet rs = null;

      ps = conex.prepareStatement("select numberexamination from examination");

      rs = ps.executeQuery();
      int i = 0;

      while (rs.next()) {
        datos[i] = rs.getInt(1);
        System.out.println(datos[i]);
        i++;
      }


    } catch (Exception e) {
    }
    return datos;
  }
}
